home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 172
/
172.d81
/
b.star batch
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
12KB
|
722 lines
10 rem * star batch creator *
11 rem * by ken robinson 5/98 *
12 rem * 1998 j&f publishing *
13 :
14 poke55,0:poke56,160:clr
15 dv=peek(186):ifdv<8thendv=8
16 :
17 c1$="\":rem * delay character *
18 c2$="_":rem * input character *
19 :
20 deffnh(q)=int(q/256)
21 deffnl(q)=q-256*fnh(q)
22 diml(100)
30 poke53272,23:poke648,4:poke56576,199:gosub5000
31 print" [155][197][206][212][197][210] [201][206][211][212][193][204][204][193][212][201][207][206] [193][196][196][210][197][211][211]"
32 print" [155][193]ccepts dec or $hex"
33 print" like 49152 or $c000":poke53265,27
34 print" [201]nstallation [193]ddress: ? ";
35 gosub800:ifef=2then39000
36 ifef=1thenprint"[150][201]llegal number!":goto34
37 ifn<2352orn>52736or(n>40448andn<49152)thenprint"[150][195]an't fit it there!":goto34
38 sa=n:s2=sa+256:b1=40960:ifsa>40704thenb1=53248
39 b2=49408+(b1-s2):ifb2>53248thenb2=53248
40 df=49152-sa
99 rem stop
200 gosub5000:gosub5005:poke53265,27
230 print
232 print"[159] [201]nstall. [193]ddr. =";sa;:n=sa:gosub850:printw$:print
235 s3=49408:print"[159]"b2-s3;"bytes free":print:ln=1
238 ln$="[147][144]poke53280,0:poke53281,0"
239 l(1)=s3:poke198,0:print"";ln;"[157]:";:poke212,1:println$;:goto265
240 ln$="":l(ln)=s3
245 poke198,0:print"";ln;"[157]:";:goto265
250 tt=ti+20
255 iftt>tithen270
260 tf=not(tf):iftf=0thenpoke212,0:print" [157]";:goto250
265 poke212,0:print" [146][157]";:goto250
270 geta$:ifa$=""then255
275 ifa$=chr$(148)thena$=chr$(142)
280 ifln$=""thenifa$=chr$(20)then255
290 ifa$=chr$(13)ora$=chr$(141)ora$=""then319
295 ifa$=""then355
300 ifa$=""then349
302 ifa$=""thenpoke212,0:print" ":goto39000
303 ifa$=""then352
304 ifa$=""then346
305 iflen(ln$)=>75thenifa$<>chr$(20)then255
308 poke212,1:printa$;
310 ifa$<>chr$(20)thenln$=ln$+a$:goto265
315 ln$=left$(ln$,len(ln$)-1):goto265
319 ifln=>100orln$=""then255
320 poke212,0:ifa$=chr$(13)thenprint"m[146]"
321 ifa$=chr$(141)thenprint"[205][146]"
322 ifa$=""thenprint"l[146]":a$=""
323 ln$=ln$+a$
325 l=len(ln$):ifl=0then345
326 ifb2-(s3+l+1)=<0thenprint"[150][207]verflow!!! [210]etype line or quit.":goto240
330 forx=0tolen(ln$)-1
335 pokes3,asc(mid$(ln$,x+1,1)+chr$(0)):s3=s3+1
340 nextx:pokes3,0
345 ln=ln+1:goto240
346 ifln$<>""orln<2then255
347 poke212,0:print" "
348 ln=ln-1:s3=l(ln):pokes3,0:goto240
349 ifln$<>""then255
350 poke212,0:print" "
351 print:print"[159]"b2-s3"bytes free":goto240
352 ifln$=""then255
353 poke212,0:forj=1tolen(ln$):print" [157][157]";:next:ln$="":goto260
355 ifs3=49408orln$<>""then255
357 poke212,0:print" "
358 print"[155][195]onfirm - are you finished? (y/n)";
359 poke198,0
360 geta$:ifa$<>"y"anda$<>"n"then360
365 printa$:ifa$="n"thenprint:goto240
370 gosub5000:print:printtab(8);"[155][208][210][207][195][197][211][211][201][206][199][160][194][193][212][195][200][160][198][201][204][197]..."
375 printtab(8)"* * * * * * * * * * * *"
380 printtab(8)"[145]";:poke53265,27
385 ad=sa:gosub1000
390 gosub5000:poke53265,27
392 print"[155][197]nter [211]ave [198]ilename: ? ";:nf=0:l=15:w$="":gosub830
395 ifw$=""then38000
396 fl$=w$
397 print"[155][197]nter [211]ave [196]evice # ? ";
398 w$=mid$(str$(dv),2):print"[159]";w$;:l=2:gosub804
399 ifef=2then38000
400 if(ef)or(n<8orn>29)then397
402 open2,n,2:close2:ifstthen397
404 dv=n
410 close15:open15,dv,15:ifstthenprint"[150][196]evice not present!":goto492
415 close2:open2,dv,2,"0:"+fl$+",p,w"
420 input#15,er,er$,et,es:ifer=0then530
422 close2:ifer<>63then490
424 print"[150][198]ile exists! [196]elete it? (y/n) ";
425 poke198,0
426 geta$:ifa$<>"y"anda$<>"n"then426
428 printa$:ifa$="n"then400
430 print#15,"s0:"+fl$:goto415
490 print"[150][196]isk error: ";er$
492 close2:close15:print"[158][208]ress [211][208][193][195][197] [194][193][210] to continue."
494 poke198,0:wait198,1:geta$:goto390
500 rem * save batch file *
530 restore
535 s1=sa
540 ea=sa+(s3+1-49152)
545 ee=ea-s1+2093:eh=fnh(ee):el=fnl(ee)
550 sy=sa
565 print"[211]aving [194]atch [198]ile...."
585 gosub625
595 forx=49152tos3+1
600 a=peek(x)
605 print#2,chr$(a);
615 next:close2:close15:goto38000
620 rem
625 reada:ifa<0thenonabs(a)gosub645,650,655,660,665,670
630 print#2,chr$(a);
635 ife=0then625
640 return
645 a=el:return
650 a=eh:return
655 a=fnl(ea+1):return
660 a=fnh(ea+1):return
665 a=fnl(sy):return
670 a=fnh(sy):e=1:return
675 rem
680 ifleft$(a$,1)="$"andlen(a$)=5thena$=right$(a$,4):gosub690:return
685 a=val(a$):return
690 a=0:p=4096:forx=1to4:l$=mid$(a$,x,1):gosub710:a=a+p*n
695 p=p/16
700 nextx:return
705 rem
710 n=0
715 n=-15*(l$="f")-14*(l$="e")-13*(l$="d")-12*(l$="c")-11*(l$="b")-10*(l$="a")
720 ifn=0thenn=val(l$)
725 return
730 rem
735 rem
740 data1,8
745 rem
750 data12,8,10,0,158,32,50,48,54,50,0,0,0
755 rem
760 data169,44,133,95,169,8,133,96
765 data169,-1,133,90,169,-2,133,91
770 data169,-3,133,88,169,-4,133,89
775 data32,191,163,76,-5,-6
780 input#15,er,er$,et,es:ifer=0thenreturn
785 print" disk error [146]"er;er$;et;es
790 close1:close2:close15
795 poke198,0:wait198,1:return
800 l=4:w$=""
804 ef=0:n=0:nf=-1:gosub830
806 ifw$=""thenef=2:return
808 ifasc(w$)=36then814
810 n=val(w$):if n=0 and w$<>"0"thenef=1
811 if n<0orn=>16^lthenef=1
812 return
814 iflen(w$)<>l+1thenef=1:return
816 forxx=0tol-1
818 yy=asc(mid$(w$,l+1-xx,1))and127
820 yy=yy-48:ifyy>9thenyy=yy-7
821 ifyy<0oryy>15thenef=1
822 n=n+yy*(16^xx):next
823 if n<0orn=>16^lthenef=1
824 return
830 poke198,0
832 tt=ti+20
834 geta$:ifa$<>""then840
836 iftt>tithen834
837 tf=not(tf):iftf=0thenprint" [157]";:goto832
838 print" [146][157]";:goto832
840 ifa$=chr$(13)thenprint" ":return
842 ifa$=chr$(20)andw$<>""thenprint" [157][157]";:w$=left$(w$,len(w$)-1):goto838
843 iflen(w$)=l+1then834
844 ifa$="0"or(val(a$)>0andval(a$)<10)then849
845 if(a$=>"a"anda$<="f")or(a$=>"[193]"anda$<="[198]")ora$="$"then849
847 ifnf=0thenif(asc(a$)and96)thenifa$<>chr$(34)then849
848 goto834
849 w$=w$+a$:print"[159]";a$;:goto838
850 w$="":forxx=0to3
852 yy=n-int(n/16)*16:ifyy>9thenyy=yy+7
854 w$=chr$(yy+48)+w$:n=int(n/16)
856 next:w$="($"+w$+")":return
980 rem * relocating test *
990 deffnh(q)=int(q/256)
991 deffnl(q)=q-256*fnh(q)
999 ad=50000:df=49152-ad:sa=ad:c1$="\":c2$="_":gosub1000:end
1000 b$=" ":a=32
1005 gosub4000
1010 a=204
1015 gosub4000
1020 a=255
1025 gosub4000
1030 a=169
1035 gosub4000
1040 a=fnl(sa+256)
1045 gosub4000
1050 a=141
1055 gosub4000
1060 a=203:a0=ad
1065 gosub4000
1070 a=192
1075 gosub4000
1080 a=169
1085 gosub4000
1090 a=fnh(sa+256)
1095 gosub4000
1100 a=141
1105 gosub4000
1110 a=204:a1=ad
1115 gosub4000
1120 a=192
1125 gosub4000
1130 a=169
1135 gosub4000
1140 a=147
1145 gosub4000
1150 a=32
1155 gosub4000
1160 a=210
1165 gosub4000
1170 a=255
1175 gosub4000
1180 a=169
1185 gosub4000
1190 a=0
1195 gosub4000
1200 printb$;:a=141
1205 gosub4000
1210 a=217:a2=ad
1215 gosub4000
1220 a=192
1225 gosub4000
1230 a=141
1235 gosub4000
1240 a=218:a3=ad
1245 gosub4000
1250 a=192
1255 gosub4000
1260 a=141
1265 gosub4000
1270 a=219:a4=ad
1275 gosub4000
1280 a=192
1285 gosub4000
1290 a=120
1295 gosub4000
1300 a=173
1305 gosub4000
1310 a=20
1315 gosub4000
1320 a=3
1325 gosub4000
1330 a=141
1335 gosub4000
1340 a=98:a5=ad
1345 gosub4000
1350 a=192
1355 gosub4000
1360 a=173
1365 gosub4000
1370 a=21
1375 gosub4000
1380 a=3
1385 gosub4000
1390 a=141
1395 gosub4000
1400 printb$;:a=99:a6=ad
1405 gosub4000
1410 a=192
1415 gosub4000
1420 a=169
1425 gosub4000
1430 a=54:a7=ad
1435 gosub4000
1440 a=141
1445 gosub4000
1450 a=20
1455 gosub4000
1460 a=3
1465 gosub4000
1470 a=169
1475 gosub4000
1480 a=192:a8=ad
1485 gosub4000
1490 a=141
1495 gosub4000
1500 a=21
1505 gosub4000
1510 a=3
1515 gosub4000
1520 a=88
1525 gosub4000
1530 a=96
1535 gosub4000
1540 a=173:pokea7+df,fnl(ad):pokea8+df,fnh(ad)
1545 gosub4000
1550 a=217:a7=ad
1555 gosub4000
1560 a=192
1565 gosub4000
1570 a=201
1575 gosub4000
1580 a=0
1585 gosub4000
1590 a=208
1595 gosub4000
1600 printb$;:a=76
1605 gosub4000
1610 a=173
1615 gosub4000
1620 a=219:a8=ad
1625 gosub4000
1630 a=192
1635 gosub4000
1640 a=201
1645 gosub4000
1650 a=0
1655 gosub4000
1660 a=208
1665 gosub4000
1670 a=32
1675 gosub4000
1680 a=165
1685 gosub4000
1690 a=198
1695 gosub4000
1700 a=201
1705 gosub4000
1710 a=0
1715 gosub4000
1720 a=208
1725 gosub4000
1730 a=23
1735